﻿using System.Data;
using Sunny.Core.DefinedData;
using Sunny.Core.Domain.Model;

namespace Sunny.Core.Domain.Repository
{
    public interface IRepository
    {
        IAggregateRoot GetByKey(SKey key);

        void Insert(IAggregateRoot model);

        void Update(IAggregateRoot model);

        void Delete(IAggregateRoot model);

        void TransactionInsert(IAggregateRoot model, IDbTransaction transaction);

        void TransactionUpdate(IAggregateRoot model, IDbTransaction transaction);

        void TransactionDelete(IAggregateRoot model, IDbTransaction transaction);
    }

    public interface IRepository<T> : IRepository
        where T : IAggregateRoot
    {
        new T GetByKey(SKey key);

        void Insert(T model);

        void Update(T model);

        void Delete(Model<T> model);
    }
}
